class MyExcpetion(Exception):
    def __str__(self):
        return "自定义异常"
    pass
try:
    num=int(input("请输入一个数字："))
    if num>10:
        raise MyExcpetion
    pass
except MyExcpetion as msg:
    print(msg)
    pass
else:
    print("没有出现异常哟")